package cn.hunqing.web.dto;

import java.text.SimpleDateFormat;

import cn.hunqing.web.entity.MyCard;

public class MyCardSimpleDto {
	private int weddingInvitationId;
	private int templateId;
	private String preview;
	private String bridegroom;
	private String bride;
	private String name;
	private String subname;
	private String weddingDay;
	private String weddingTime;
	private String weddingHotel;
	private String weddingAddress;
	private String weddingHall;
	private String createdAt;
	private WeChatShareDto weChatShareDto;
	private int isPayed;

	public int getWeddingInvitationId() {
		return weddingInvitationId;
	}

	public void setWeddingInvitationId(int weddingInvitationId) {
		this.weddingInvitationId = weddingInvitationId;
	}

	public int getTemplateId() {
		return templateId;
	}

	public void setTemplateId(int templateId) {
		this.templateId = templateId;
	}

	public String getPreview() {
		return preview;
	}

	public void setPreview(String preview) {
		this.preview = preview;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSubname() {
		return subname;
	}

	public void setSubname(String subname) {
		this.subname = subname;
	}

	public String getBridegroom() {
		return bridegroom;
	}

	public void setBridegroom(String bridegroom) {
		this.bridegroom = bridegroom;
	}

	public String getWeddingDay() {
		return weddingDay;
	}

	public void setWeddingDay(String weddingDay) {
		this.weddingDay = weddingDay;
	}

	public String getWeddingTime() {
		return weddingTime;
	}

	public void setWeddingTime(String weddingTime) {
		this.weddingTime = weddingTime;
	}

	public String getBride() {
		return bride;
	}

	public void setBride(String bride) {
		this.bride = bride;
	}

	public String getWeddingHotel() {
		return weddingHotel;
	}

	public void setWeddingHotel(String weddingHotel) {
		this.weddingHotel = weddingHotel;
	}

	public String getWeddingAddress() {
		return weddingAddress;
	}

	public void setWeddingAddress(String weddingAddress) {
		this.weddingAddress = weddingAddress;
	}

	public String getWeddingHall() {
		return weddingHall;
	}

	public void setWeddingHall(String weddingHall) {
		this.weddingHall = weddingHall;
	}

	public String getCreatedAt() {
		return createdAt;
	}

	public void setCreatedAt(String createdAt) {
		this.createdAt = createdAt;
	}

	public WeChatShareDto getWeChatShareDto() {
		return weChatShareDto;
	}

	public void setWeChatShareDto(WeChatShareDto weChatShareDto) {
		this.weChatShareDto = weChatShareDto;
	}
	
	public int getIsPayed() {
		return isPayed;
	}

	public void setIsPayed(int isPayed) {
		this.isPayed = isPayed;
	}

	public static MyCardSimpleDto buildFrom(MyCard myCard) {
		if (myCard == null) {
			return null;
		}
		MyCardSimpleDto result = new MyCardSimpleDto();
		result.setPreview(myCard.getPreview());
		result.setBride(myCard.getBride());
		result.setBridegroom(myCard.getBridegroom());
		if(myCard.getCreatedAt() != null){
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
			try{
				result.setCreatedAt(sdf.format(myCard.getCreatedAt()));
			}catch(Exception e){
				e.printStackTrace();
			}
		}
		result.setPreview(myCard.getPreview());
		result.setName(myCard.getName());
		result.setSubname(myCard.getSubname());
		result.setTemplateId(myCard.getTemplateId());
		result.setWeddingInvitationId(myCard.getWeddingInvitationId());
		result.setWeddingAddress(myCard.getWeddingAddress());
		result.setWeddingDay(myCard.getWeddingDay());
		result.setWeddingHall(myCard.getWeddingHall());
		result.setWeddingHotel(myCard.getWeddingHotel());
		result.setIsPayed(myCard.getIsPayed());
		// result.setName(myCard.getName());
		// result.setSubname(myCard.getSubname());
		return result;
	}
}
